package com.Services;

import com.Dao.RecruitmentDao;
import com.entity.Recruitment;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Created by Administrator on 2017/3/18.
 */
public class RecruitmentService {
    private RecruitmentDao rd;

    public RecruitmentDao getRd() {
        return rd;
    }

    public void setRd(RecruitmentDao rd) {
        this.rd = rd;
    }

    /**
     * 添加公告
     */
    public void addRecruitment( String post, String department, String neednumbers, String wage, String year,
             String month, String day, String content, String examtype, String requirement){
        Recruitment r=new Recruitment();
        r.setDateline(year+"-"+month+"-"+day);
        r.setNeednumbers(Integer.parseInt(neednumbers));
        r.setDepartment(department);
        r.setPost(post);
        r.setWage(Integer.parseInt(wage));
        r.setExamtype(examtype);
        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");//设置日期格式
        r.setPublishdate(df.format(new Date()).toString());
        r.setRequirement(requirement);
        r.setContent(content);
        rd.addRecruitment(r);
    }
    /**
     * 删除公告
     */
    public void deleteGonggao(int id){
        rd.deleteRecruitment(id);
    }
}
